/**
 * 封装关注取关模块
 */
import request from '@/utils/request.js'
/**
 * 关注
 */
export const addFollow = userId => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}
/**
 * 取关
 */
export const deleteFollow = userId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${userId}`
  })
}

/**
 * 获取用户信息
 */
export const getUserProfile = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/profile'
  })
}

/**
 * 编辑用户个人资料
 */
export const modifyUserData = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data
  })
}

/**
 * 修改用户头像
 */
export const updateUserPhoto = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data
  })
}
/**
 * 获取用户收藏
 */
export const getUserCollection = data => {
  return request({
    method: 'GET',
    url: '/v1_0/article/collections',
    data
  })
}
/**
 * 获取用户浏览历史
 */
export const getUserHistory = data => {
  return request({
    method: 'GET',
    url: '/v1_0/user/histories',
    data
  })
}
